//:C05:BearCorner2.cpp
// Illustrates policy classes.
#include <iostream>
#include "BearCorner.h"
using namespace std;

// Policy classes (require a static doAction() function)
class Feed
{
    public:
        static const char* doAction() { return "Feeding"; } 
};

class Stuff
{
    public:
        static const char* doAction() { return "Stuffing"; }
};

// The Guest template (uses a policy and a traits class)
template<class Guest, class Action,
    class traits = GuestTraits<Guest>>
class BearCorner
{
    Guest theGuest;
    typedef typename traits::beverage_type beverage_type;
    typedef typename traits::snack_type snack_type;
    beverage_type bev;
    snack_type snack;
    public:
        BearCorner(const Guest& g)  : theGuest(g){}
        void entertain()
        {
            cout << Action::doAction() << " " << theGuest
                 << " and " << snack << endl;
        }
};    

int main(void)
{
    Boy cr;
    BearCorner<Boy, Feed> pc1(cr);
    pc1.entertain();
    Bear pb;
    BearCorner<Bear, Stuff> pc2(pb);
    pc2.entertain();
}